﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="MainViewModel.cs" company="http://buginbox.wordpress.com/">
//   Copyright (c) GNU General Public License version 2 (GPLv2)
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

using System.ComponentModel.Composition;
using App.Common.Constant;
using Microsoft.Practices.Prism.Regions;
using Wpf.Core.Region;
using Wpf.Core.ViewModel;

namespace Module.Main.View
{
    /// <summary>
    /// The main view model.
    /// </summary>
    [Export(typeof(MainViewModel))]
    [PartCreationPolicy(CreationPolicy.NonShared)]
    public class MainViewModel : ViewModelBase
    {
        #region Constructor(s)

        /// <summary>
        /// Initializes a new instance of the <see cref="MainViewModel"/> class.
        /// </summary>
        [ImportingConstructor]
        public MainViewModel()
        {
        }

        #endregion

        #region Public methods

        /// <summary>
        /// Inits the view.
        /// </summary>
        /// <param name="regionManager">
        /// The region manager. 
        /// </param>
        /// <returns>
        /// The Microsoft.Practices.Prism.Regions.IRegionManager.
        /// </returns>
        public IRegionManager InitView(IRegionManager regionManager)
        {
            var mainView = new MainView();
            View = mainView;

            IRegionManager innerRegionManager = RegionHelper.AddView(regionManager, RegionName.MainRegion, 1, mainView, "MainView", this);

            return innerRegionManager;
        }

        #endregion
    }
}